//
//  XSAlbumListTableViewCell.m
//  AudioVideo
//
//  Created by xueshan1 on 2019/9/16.
//  Copyright © 2019 xueshan1. All rights reserved.
//

#import "XSAlbumListTableViewCell.h"

@interface XSAlbumListTableViewCell ()

@property (nonatomic, copy) NSString *identifier;

@end

@implementation XSAlbumListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(XSAlbumListModel *)model{
    _model = model;
    
    self.identifier = model.headImageAsset.localIdentifier;
    [XSPhotosManager requestImageForAsset:model.headImageAsset size:self.imageV.bounds.size progressHandler:nil completion:^(UIImage *image, NSDictionary *info) {
 
        if ([self.identifier isEqualToString:model.headImageAsset.localIdentifier]) {
            self.imageV.image = image?:ImageName(@"zl_defaultphoto");
        }
    }];
    
    self.titleLab.text = model.title;
    self.countLab.text = [NSString stringWithFormat:@"(%ld)", model.count];
    
    CGFloat wid = [model.title getSizeWithFontSize:15 maxWidth:300].width;
    self.titleLab.width = wid + 5;
    
    self.countLab.x = self.titleLab.right;
    
}

@end
